package com.baixun.gassystem.mapper;

import com.baixun.gasentity.entity.SysDepartmentRolePermissions;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 系统部门角色权限的Mapper接口
 * 继承自BaseMapper，用于对SysDepartmentRolePermissions实体类进行数据库操作
 */
@Mapper
public interface SysDepartmentRolePermissionsMapper extends BaseMapper<SysDepartmentRolePermissions> {

    @Select("SELECT p.permission FROM sys_department_role_permissions rp " +
            "JOIN sys_department_permissions p ON rp.permission_id = p.id " +
            "WHERE rp.role_id = #{roleId}")
    List<String> findPermissionsByRoleId(@Param("roleId") Long roleId);
}
